import { request } from '@umijs/max'; 

// 查询岗位信息列表
export async function getTenantList(params?: API.System.TenantListParams) {
  return request<API.System.tenantPageResult>('/api/system/tenant/list', {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8',
    },
    params
  });
}

// 查询岗位信息详细
export function getTenant(tenantId: number) {
  return request<API.System.TenantInfoResult>(`/api/system/tenant/${tenantId}`, {
    method: 'GET'
  });
}

// 新增岗位信息
export async function addTenant(params: API.System.Tenant) {
  return request<API.Result>('/api/system/tenant', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8',
    },
    data: params
  });
}

// 新增岗位信息
export async function registerTenant(params: API.System.Tenant) {
  return request<API.Result>('/api/system/tenant/register', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8',
    },
    data: params
  });
}

// 修改岗位信息
export async function updateTenant(params: API.System.Tenant) {
  return request<API.Result>('/api/system/tenant', {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8',
    },
    data: params
  });
}
// 修改岗位信息
export async function updateTenantApproval(params: API.System.Tenant) {
  return request<API.Result>('/api/system/tenant/approval', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8',
    },
    data: params
  });
}

// 删除岗位信息
export async function removeTenant(ids: string) {
  return request<API.Result>(`/api/system/tenant/${ids}`, {
    method: 'DELETE'
  });
}

// 导出岗位信息
export function exportTenant(params?: API.System.TenantListParams) { 
  return request<API.Result>(`/api/system/tenant/export`, {
    method: 'GET',
    params
  });
}

// 获取商户进件信息
export function getJoinTenantInfo(params: any) {
  return request<API.System.TenantInfoResult>(`/api/system/tenant/getJoinTenantInfo`, {
    method: 'GET',
    params
  });
}

// 保存商户进件信息
export function saveJoinTenantInfo(params: any) {
  return request<API.System.TenantInfoResult>(`/api/system/tenant/joining`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8',
    },
    data: params
  });
}

// 绑定银行卡确认
export function bindCardConfirm(params: any) {
  return request<API.System.TenantInfoResult>(`/api/system/tenant/bindCardConfirm`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8',
    },
    data: params
  });
}